<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #outer{
            width: 500px;
            height: 300px;
            background-color: aqua;
            overflow-y:scroll;
        }
        #inner{
            width: 500px;
            height: 1000px;
        }
    </style>
</head>
<body>
    <div id="outer">
        <div id="inner"></div>
    </div>
    <script>
        document.getElementById("outer").addEventListener("scroll",function(e){
            console.log(e.target.scrollTop);// 表示滚动条滚动的距离
            console.log(e.target.scrollHeight); // 内容器的高度
            console.log(e.target.clientHeight); // 外容器的高度
            console.log(e.target.scrollHeight-e.target.clientHeight-e.target.scrollTop);
        })
    </script>
</body>
</html>